package ZY11_09;

import java.util.Scanner;

public class ZiFuChuan {
    public static void main(String[] args) {
        //定义字符串
         String str="abc";
         String ss="abcabcabc";
        //定义返回的次数
        int count=0;
        for (int i=0;i<ss.length();i++) {
            //比较字符串A中截取
            for (int j=i;j<=ss.length();j++) {
                if (ss.substring(i, j).equals(str))
                    count++;
            }
        }
        System.out.println("字符串"+str+"出现了"+count+"次");

//        String str = null,ss = null;
//        Scanner in=new Scanner(System.in);
//        System.out.println("其请输入第一个字符串：");
//        str.indexOf(in.next());
//        System.out.println("其请输入第二个字符串：");
//        ss.indexOf(in.next());
//        String contains = String.valueOf(a1.indexOf(a));
//        System.out.println(contains);
    }
}
